from pymysql import Connection

conn = Connection(
    host="localhost",
    port= 3306,
    user="root",
    password="123456",
    autocommit=True#自动提交（确认）
)
cursor = conn.cursor()
conn.select_db("test")#选择数据库
cursor.execute("insert into test_pymysql values(10001, '李四', 30, '女')")
#pymysql库在执行对数据库的修改时，需要通过commit确认，手动或自动
# conn.commit()
conn.close()